﻿using CPPEI.ETL.DataServiceInterface;
using CPPEI.WebApi;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using ENT = CPPEI.ETL.Domain.Entities;
using MOD = CPPEI.ETL.Domain.Models;
using SER = CPPEI.ETL.Domain.Services;

namespace CPPEI.ETL.WebApi.DataVerificationRule
{
    /// <summary>
    /// 删除数据审核规则
    /// </summary>
    [CPPEI.WebApi.AuthPostAction("DVR", "Delete", "1.0")]
    public class DeleteAction : BaseAction<DeleteParams, DeleteResult>
    {
        protected override ActionResult<DeleteResult> OnExecute(ActionContext context, 
            SysParameters sysParameters,
            DeleteParams opParams)
        {
            SER.DataVerificationRuleService service = new SER.DataVerificationRuleService();
            ServiceResult result = service.Delete(opParams.Id);
            if(result.IsSuccess)
            {
                return new ActionResult<DeleteResult>(new DeleteResult());
            }
            else
            {
                return new ActionResult<DeleteResult>(result.IsSuccess, result.ErrorCode, result.Message, null);
            }
        }
    }

    public class DeleteParams
    {
        [Parameter]
        public Guid Id { get; set; }
    }

    public class DeleteResult
    {
    }
}
